# Maintainer: Jenneron <jenneron@protonmail.com>
pkgname=xf86-video-opentegra
pkgver=0.6.0_git20211025
pkgrel=0
pkgdesc="X.Org driver for NVIDIA tegra"
url="https://github.com/grate-driver/xf86-video-opentegra"
# This driver is useful only on armv7 Tegra SoCs
arch="armv7"
license="MIT"
subpackages="$pkgname-doc"
depends="libdrm"
makedepends="
	autoconf
	automake
	bash
	bison
	bsd-compat-headers
	flex
	fontsproto
	libdrm-dev
	libtool
	m4
	util-macros
	xorg-server-dev
	xproto
	"
_commit="9be4b4aa7c81b9b43496e8621954a0f4b343f3b1"
source="$pkgname-$_commit.tar.gz::$url/archive/$_commit.tar.gz"
builddir="$srcdir"/$pkgname-$_commit

prepare() {
	default_prepare

	# doesn't work without these flags
	export LDFLAGS="$LDFLAGS -Wl,-z,lazy"

	./autogen.sh \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr
}

build() {
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install

	install -Dm644 "$builddir"/COPYING \
		-t "$pkgdir"/usr/share/licenses/"$pkgname"
}

sha512sums="
199bc7d80486f3378cfa5eec70f5b7660598bab5d8ecc4896da28dbba72e8d917bf3333e5d6ae7b2d50569ddb77392c883ca0393bff30b3f28caa471cb5ee547  xf86-video-opentegra-9be4b4aa7c81b9b43496e8621954a0f4b343f3b1.tar.gz
"
